package xiangMu.auto.auto02;

public abstract class Auto {    //汽车类
    private String type;        //车的类型(轿车或客车)
    private String brand;        //车的品牌
    private String series;       //车的型号(系列)
    private String licencePlate;   //车牌号
    private int seatNumber;     //座位数
    private int dayRent;        //日租金
    private boolean state = true;      //车的租赁状态，应该给个默认值，默认为true,未出租状态

    public Auto() { //无参构造方法
    }

    public Auto(String type, String brand, String series, String licencePlate, int seatNumber, int dayRent) {
        this.type = type;
        this.brand = brand;
        this.series = series;
        this.licencePlate = licencePlate;
        this.seatNumber = seatNumber;
        this.dayRent = dayRent;
    }

    public abstract double calcRent(int days);  //抽象方法，计算总租金

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getSeries() {
        return series;
    }

    public void setSeries(String series) {
        this.series = series;
    }

    public String getLicencePlate() {
        return licencePlate;
    }

    public void setLicencePlate(String licencePlate) {
        this.licencePlate = licencePlate;
    }

    public int getSeatNumber() {
        return seatNumber;
    }

    public void setSeatNumber(int seatNumber) {
        this.seatNumber = seatNumber;
    }

    public int getDayRent() {
        return dayRent;
    }

    public void setDayRent(int dayRent) {
        this.dayRent = dayRent;
    }

    public boolean isState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }

    @Override
    public String toString() {
        String message = type + "  " + brand + series + ",车牌：" + licencePlate + "," + seatNumber + "座，日租金：¥" + dayRent + "元，";
        if (isState())
            return message + "当前可租";
        else
            return message + "当前已出租";
    }
}

